<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>{$title}-<tp:sitename /></title>
    <link rel="shortcut icon" href="__PUBLIC__/images/favicon.ico" type="image/x-icon" /> 
    <link rel="stylesheet" href="__PUBLIC__/css/style_version1.css" type="text/css" />
    <link rel="stylesheet" href="__PUBLIC__/css/base.css">
    <script src="__PUBLIC__/js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
	function changeVcode(obj){
		$("#VCode").attr("src",'<tp:vcodeurl />'+ '#'+Math.random());
		return false;
	}
	</script>
</head> 
<body> 

<include file="Public:header" />

<div class="wrap">
    <div class="pop-title clearfix">
        <a class="a_underline" href="{:U('Public/register')}">注册</a>   
        <div class="pop_name">
            会员登录
        </div>

    </div>
    <form onsubmit="return false">
        <div class="pop-content accountPage">
            <div class="form_item">
                <div class="item_tip">用户名/邮箱</div>
                <input type="text" tabindex="1" value="" name="email" class="form_input" id="email" onblur="blurInputLoginBox($(this))" onfocus="focusInputLoginBox($(this))" autocomplete="off">
                <span class="error">不能为空</span>
                <i class="icon-loginright"></i>
            </div>	
            <div class="form_item">
                <div class="item_tip">密码</div>
                <input type="password" tabindex="2" name="password" class="form_input" id="pwd" onblur="blurInputLoginBox($(this))" onfocus="focusInputLoginBox($(this))" autocomplete="off">
                <span class="error">不能为空</span>
                <span class="grey">6 - 20位</span>
                <i class="icon-loginright"></i>
            </div>
            
            <if condition="C('CFG_VERIFY_LOGIN') eq 1">
            <div class="form_item">
                <div class="item_tip">验证码</div>
                <input type="text" tabindex="3" value="" name="vcode" class="small_input" id="code" onblur="blurInputLoginBox($(this))" onfocus="focusInputLoginBox($(this))" autocomplete="off"><img src="<tp:vcodeurl />" id="VCode" style="vertical-align:middle; cursor:pointer;" height="35" onClick="javascript:changeVcode(this);" />
                <span class="error">不能为空</span>
                <i class="icon-loginright"></i>
            </div>
            </if>
            
            <div class="twoWeeks">
                <input type="checkbox" class="ckeckBox" name="rememberme" id="rememberme" checked="checked" value="1" />
                <label for="rememberme">两周内免登录</label>
                <!--<a class="a_underline" href="{:U('Public/forget')}">忘记密码？</a>-->
            </div>
            <p class="notice_error" id="notice_error"></p>
            <input type="submit" tabindex="7" value="登&nbsp;&nbsp;录" class="btn_reg btn" id="btn_reg" onclick="subLogin($(this))">
            
        </div>
    </form>
</div>

<script type="text/javascript">
    function subLogin(obj) {
        var email = $.trim($('#email').val());
        var pwd = $.trim($('#pwd').val());
		var code = $.trim($('#code').val());
		if($("#rememberme").attr("checked")){
			var rememberme = 1;
		}else{
			var rememberme = 0;
		}
        if (email == '') {
            showLoginError("请输入邮箱");
            return false;
        }
        if (pwd == '') {
            showLoginError("请输入密码");
            return false;
        }
		<if condition="C('CFG_VERIFY_LOGIN') eq 1">
		if (code == '') {
            showLoginError("请输入验证码");
            return false;
        }
		</if>

        obj.addClass('disabled').val('登录中...');
        $.post("{:U('Ajax/checkLogin')}", {email: email, password: pwd, vcode: code, rememberme: rememberme}, function(data) {
            if (data.error != '') {
                showLoginError(data.error);
            } else {
                showSuccessTip(data.tip);
                var url = "<tp:siteurl />";
                setTimeout("goUrl('" + url + "')", 1000);
            }
            obj.removeClass('disabled').val('登录');
        }, "json")

    }
    function showLoginError(tip) {
        $("#notice_error").text(tip).show();
        $("#notice_error").fadeOut(2500);
    }
</script>

<include file="Public:footer" />

</body>
</html>
